//
//  HTActivityTVCell.m
//  豆瓣
//
//  Created by lanou3g on 15/12/10.
//  Copyright © 2015年 HaiTeng. All rights reserved.
//

#import "HTActivityTVCell.h"
#import "UIImageView+WebCache.h"
@interface HTActivityTVCell ()

@property(nonatomic,strong)UIImageView *time_image; //时间标题图片
@property(nonatomic,strong)UIImageView *address_image; //地址标题图片
@property(nonatomic,strong)UIImageView *category_image; //类型标题图片


@property(nonatomic,strong)UILabel *time_label; //时间标题
@property(nonatomic,strong)UILabel *category_name_label; //活动类型标题
@property(nonatomic,strong)UILabel *wisher_label;//兴趣标题
@property(nonatomic,strong)UILabel *participant_label;//参加标题


@property(nonatomic,strong)UIImageView *AView; //背底图;

@property(nonatomic,strong)UIImageView *BView; //背景地图2;

@end


@implementation HTActivityTVCell





//Model赋值
- (void)setModel:(ActivityModel *)model
{
    
    if (model) {
        _model = model;
    }
    
    self.title_cell.text = model.title;
    self.begin_time_cell.text = model.begin_time;
//    self.end_time_cell.text = model.end_time;
    self.address_cell.text = model.address;
    self.category_name_cell.text = model.category_name;
    self.participant_count_cell.text = [NSString stringWithFormat:@"%d",model.participant_count];
    self.wisher_count_cell.text = [NSString stringWithFormat:@"%d",model.wisher_count];
    [self.image_cell sd_setImageWithURL:[NSURL URLWithString:model.image] placeholderImage:[UIImage imageNamed:@"picholder"]];
//
//    
    
    
    
}











- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if ([super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self addAllViews];
    }
    
    
    return self;
}



//创建视图
- (void)addAllViews{

    self.AView = [[UIImageView alloc] init];
    self.AView.image = [UIImage imageNamed:@"bg_eventlistcell"];
    [self addSubview:self.AView];
    
    
        self.BView = [[UIImageView alloc] init];
    self.BView.image = [UIImage imageNamed:@"bg_share_large"];
    [self.AView addSubview:self.BView];
    
    
    //活动标题
    self.title_cell = [[UILabel alloc] init];
//    self.title_cell.text = @"城市的经理开始觉得快乐的快乐";
    self.title_cell.font = [UIFont systemFontOfSize:16];
    [self.AView addSubview:self.title_cell];
    
    //时间标题图片
    self.time_image = [[UIImageView alloc] init];
    self.time_image.image = [UIImage imageNamed:@"icon_date"];
    [self.BView addSubview:self.time_image];
    
    
    
//   begin_time_cell; //开始时间
    
    self.begin_time_cell = [[UILabel alloc] init];
//    self.begin_time_cell.text = @"10-19 20:28";
    self.begin_time_cell.font = [UIFont systemFontOfSize:13];
    [self.BView addSubview:self.begin_time_cell];
    
    
    
    
//    
////time_label; //时间标题
//    
//    self.time_label = [[UILabel alloc] init];
//    self.time_label.text = @"--";
//    [self.BView addSubview:self.time_label];
//    
//// end_time_cell; //结束时间
//    self.end_time_cell = [[UILabel alloc] init];
////    self.end_time_cell.text = @"10-19 20:28";
//    self.end_time_cell.font = [UIFont systemFontOfSize:13];
//    [self.BView addSubview:self.end_time_cell];
    
//    address_image; //地址标题图片
    self.address_image = [[UIImageView alloc] init];
    self.address_image.image = [UIImage imageNamed:@"icon_spot"];
    [self.BView addSubview:self.address_image];
    
    
//   address_cell; //地址
    self.address_cell = [[UILabel alloc] init];
//    self.address_cell.text = @"背景决定就是了空间的时间考虑房价开快点开始的恶灵空间发的开始始了";
    self.address_cell.font = [UIFont systemFontOfSize:13];
    [self.BView addSubview:self.address_cell];
    
    
    
    
//    category_image; //类型标题图片
    self.category_image = [[UIImageView alloc] init];
    self.category_image.image = [UIImage imageNamed:@"icon_catalog"];
    [self.BView addSubview:self.category_image];
    
    
    
    
//category_name_label; //活动类型标题
    self.category_name_label = [[UILabel alloc] init];
    self.category_name_label.text = @"类型:";
    self.category_name_label.font = [UIFont systemFontOfSize:13];
    [self.BView addSubview:self.category_name_label];
    
    //category_name_cell; //活动类型
    self.category_name_cell = [[UILabel alloc] init];
//    self.category_name_cell.text = @"展览展览";
    self.category_name_cell.font = [UIFont systemFontOfSize:13];
    [self.BView addSubview:self.category_name_cell];
    
    //    wisher_label;//兴趣标题
    self.wisher_label = [[UILabel alloc] init];
    self.wisher_label.text = @"感兴趣:";
    self.wisher_label.font = [UIFont systemFontOfSize:13];
    [self.BView addSubview:self.wisher_label];
    
    
    //wisher_count_cell; //感兴趣人数
    self.wisher_count_cell = [[UILabel alloc] init];
//    self.wisher_count_cell.text = @"4444";
    self.wisher_count_cell.textColor = [UIColor redColor];
    self.wisher_count_cell.font = [UIFont systemFontOfSize:13];
    [self.BView addSubview:self.wisher_count_cell];
    
    
    
    
    
//    participant_label;//参加标题
    self.participant_label = [[UILabel alloc] init];
    self.participant_label.text = @"参加:";
    self.participant_label.font = [UIFont systemFontOfSize:13];
    [self.BView addSubview:self.participant_label];
    
    
//participant_count_cell; //参加人数
    self.participant_count_cell = [[UILabel alloc] init];
//    self.participant_count_cell.text = @"5555";
    self.participant_count_cell.textColor = [UIColor redColor];
    self.participant_count_cell.font = [UIFont systemFontOfSize:13];
    [self.BView addSubview:self.participant_count_cell];
    
    

//image_cell;  //活动图像(先显示占位图像)
    self.image_cell= [[UIImageView alloc] init];
//    self.image_cell.image = [UIImage imageNamed:@"picholder"];
    [self.BView addSubview:self.image_cell];
   
    
    
    
    
    
    
    
    
    
    
    
    
    
    
}








//视图布局
- (void)layoutSubviews
{
    [super layoutSubviews];
    self.AView.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
    self.BView.frame = CGRectMake(0, 30, self.frame.size.width, self.AView.frame.size.height - 33);

    //活动标题
    self.title_cell.frame = CGRectMake(10, 0, self.frame.size.width, 30);
    
    //时间标题图片
    self.time_image.frame = CGRectMake(10, 10, 16, 16);
    
    //   begin_time_cell; //开始时间
    self.begin_time_cell.frame = CGRectMake(CGRectGetMaxX(self.time_image.frame) + 5, self.time_image.frame.origin.y, 150, 16);
    
//    
//    //time_label; //时间标题
//    self.time_label.frame = CGRectMake(CGRectGetMaxX(self.begin_time_cell.frame), self.self.begin_time_cell.frame.origin.y, 18, 16);
//    
//    
//    // end_time_cell; //结束时间
//      self.end_time_cell.frame = CGRectMake(CGRectGetMaxX(self.time_label.frame), self.time_label.frame.origin.y, 100, 16);
    
    
    //    address_image; //地址标题图片
    self.address_image.frame = CGRectMake(self.time_image.frame.origin.x, CGRectGetMaxY(self.time_image.frame) + 6, self.time_image.frame.size.width,  self.time_image.frame.size.height);
    
    

    //   address_cell; //地址
    self.address_cell.frame = CGRectMake(CGRectGetMaxX(self.address_image.frame), self.address_image.frame.origin.y, 210, self.address_image.frame.size.height);
    
    
    
    //    category_image; //类型标题图片
    self.category_image.frame = CGRectMake(self.address_image.frame.origin.x, CGRectGetMaxY(self.address_image.frame) + 6, self.address_image.frame.size.width, self.address_image.frame.size.height);
    
    
    //category_name_cell; //活动类型标题
    self.category_name_label.frame = CGRectMake(CGRectGetMaxX(self.category_image.frame), self.category_image.frame.origin.y, 30, self.category_image.frame.size.height);
    
    //category_name_cell; //活动类型
    self.category_name_cell.frame = CGRectMake(CGRectGetMaxX(self.category_name_label.frame) + 10, self.category_name_label.frame.origin.y, 60, self.category_name_label.frame.size.height);
    
    
    
    
    //    wisher_label;//兴趣标题
    self.wisher_label.frame = CGRectMake(self.category_image.frame.origin.x+ 5, CGRectGetMaxY(self.category_name_label.frame) + 18, 45, self.category_name_cell.frame.size.height);
    
    

    //wisher_count_cell; //感兴趣人数
    self.wisher_count_cell.frame = CGRectMake(CGRectGetMaxX(self.wisher_label.frame )+ 10, self.wisher_label.frame.origin.y, 50, self.wisher_label.frame.size.height);
    
    
    
    //    participant_label;//参加标题
     self.participant_label.frame = CGRectMake(CGRectGetMaxX(self.wisher_count_cell.frame ), self.wisher_count_cell.frame.origin.y, 45, self.wisher_count_cell.frame.size.height);
    
    
    
    
    //participant_count_cell; //参加人数
     self.participant_count_cell.frame = CGRectMake(CGRectGetMaxX(self.participant_label.frame ), self.wisher_count_cell.frame.origin.y, 50, self.wisher_count_cell.frame.size.height);
    
    

    
    
    //image_cell;  //活动图像(先显示占位图像)
    

    self.image_cell.frame = CGRectMake(CGRectGetMaxX(self.address_cell.frame) + 20, 10, self.frame.size.width - CGRectGetMaxX(self.address_cell.frame) - 30, self.BView.frame.size.height - 20);
    
    
 
    
    
}




@end





















